package ganga.custodian.sensors;

import java.sql.Timestamp;

import android.util.Log;

public class AccelerometerValuesBasket {
	final int BASKET_SIZE = 32;
	AccelerometerData[] data;
	private int currentIndex=0;
	private AccelerometerData current;
	public AccelerometerValuesBasket(){
		data = new AccelerometerData[BASKET_SIZE];
		for (currentIndex =0;currentIndex<BASKET_SIZE; currentIndex++) {
			data[currentIndex] = new AccelerometerData();
		}
		currentIndex=0;
	}
	public synchronized void Add(Timestamp timestamp,float[] value){
		current = data[currentIndex];
		current.timestamp = timestamp.getTime();
		current.ax = value[0];
		current.ay = value[1];
		current.az = value[2];
		currentIndex += 1;
		Log.d("AccelerometerValuesBasket ", String.valueOf(currentIndex));
	}
	public boolean HasSpace(){
		return (currentIndex  < BASKET_SIZE ?  true : false); 
	}
}
